/**
 * file
 */
package com.tdkj.action.backstage.admin;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;

import javax.annotation.Resource;
import javax.persistence.Table;

import org.apache.struts2.ServletActionContext;

import com.tdkj.action.BaseAction;
import com.tdkj.model.common.BeanInformationSection;
import com.tdkj.model.common.BeanType;
import com.tdkj.model.decorate.BeanLayout;
import com.tdkj.model.decorate.BeanModule;
import com.tdkj.model.decorate.BeanStyle;
import com.tdkj.model.enterprisezone.BeanEnterprise;
import com.tdkj.model.enterprisezone.BeanEnterpriseZone;
import com.tdkj.model.enterprisezone.BeanEnterpriseZoneDecorate;
import com.tdkj.model.financial.BeanFinancialAccount;
import com.tdkj.model.information.BeanBaseInfo;
import com.tdkj.model.information.BeanExpert;
import com.tdkj.model.information.BeanInfoComment;
import com.tdkj.model.information.BeanInfoModule;
import com.tdkj.model.information.BeanInfoReply;
import com.tdkj.model.information.BeanModuleColumn;
import com.tdkj.model.risevalue.BeanAdvertAuctionBidInfo;
import com.tdkj.model.risevalue.BeanAdvertAuctionInfo;
import com.tdkj.model.selfadvert.BeanSelfAdvert;
import com.tdkj.model.shop.BeanCreditRating;
import com.tdkj.model.shop.BeanEvaluateType;
import com.tdkj.model.shop.BeanGood;
import com.tdkj.model.shop.BeanGoodShowcase;
import com.tdkj.model.shop.BeanOrder;
import com.tdkj.model.shop.BeanOrderItem;
import com.tdkj.model.shop.BeanShelf;
import com.tdkj.model.shop.BeanShop;
import com.tdkj.model.shop.BeanShoppingCart;
import com.tdkj.model.user.BeanAdmin;
import com.tdkj.model.user.BeanAdminLevel;
import com.tdkj.model.user.BeanExperienceAndIntegralCount;
import com.tdkj.model.user.BeanPermission;
import com.tdkj.model.user.BeanUser;
import com.tdkj.model.user.BeanUserExperiences;
import com.tdkj.model.user.BeanUserLevel;
import com.tdkj.model.user.BeanUserLoginLog;
import com.tdkj.model.user.BeanUserPersonal;
import com.tdkj.service.common.IBeanTypeService;
import com.tdkj.service.decorate.IBeanLayoutService;
import com.tdkj.service.decorate.IBeanModuleService;
import com.tdkj.service.decorate.IBeanStyleService;
import com.tdkj.service.shop.IBeanCreditRatingService;
import com.tdkj.service.shop.IBeanEvaluateTypeService;
import com.tdkj.service.user.IBeanExperienceAndIntegralCountService;
import com.tdkj.util.md5.MD5Util;
import com.tdkj.util.typeconverter.TimestampTypeConverter;
import com.tdkj.util.typeconverter.TypeConvertException;

/**
 * 
 * FileName: InitAction.java
 * 
 * @Description: TODO 初始化网站数据 All rights Reserved, Designed By ZTE-ITS
 * 
 *               Copyright: Copyright(C) 2010-2011
 * 
 *               Company 天成科技有限公司
 * 
 * @author: 李兴建
 * 
 * @version V1.0
 * 
 *          Createdate: 2012-7-23 下午03:44:23
 * 
 * 
 * 
 *          Modification History:
 * 
 *          Date Author Version Discription
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 *          
 *          ----------------------------------------------------------------------
 *          -------------
 * 
 *          2012-7-23 李兴建 1.0 1.0
 * 
 *          Why & What is modified: <修改原因描述>
 */
public class InitAction extends BaseAction {
	private static final long serialVersionUID = -3941580326680650698L;

	/**
	 * 初始化测试数据
	 */
	/*
	 * public String initTestData() {
	 * 
	 * return SUCCESS; }
	 */

	/**
	 * 初始化基础数据(初始化 放这...............)
	 * 
	 * @throws TypeConvertException
	 */
	public String initBaseData() throws TypeConvertException {
		initSuperAndmin();// 初始化超级管理员
		initBeanUserExperience();// 初始化网站用户
		initModule();// 初始化模块和栏目
		initInfo();// 初始化信息
		initComment();// 初始化评论

		initMall();// 商城
		initDecorate();// 商城
		initBeanExperienceAndIntegralCount();// 积分统计点

		initInformationSection();
		return SUCCESS;
	}

	// 初始化网站信息栏目
	private void initInformationSection() {
		BeanInformationSection beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("招商引资");
		beanInformationSection.setDefaultUrl("front/baseInfoAction!findModule.action?moduletype=4");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(1);
		this.getBaseService().save(beanInformationSection);
		
		beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("投资融资");
		beanInformationSection.setDefaultUrl("front/baseInfoAction!findModule.action?moduletype=5");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(2);
		this.getBaseService().save(beanInformationSection);
		
		beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("矿权信息");
		beanInformationSection.setDefaultUrl("front/baseInfoAction!findModule.action?moduletype=7");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(3);
		this.getBaseService().save(beanInformationSection);
		
		beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("矿业资源");
		beanInformationSection.setDefaultUrl("front/baseInfoAction!findModule.action?moduletype=6");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(4);
		this.getBaseService().save(beanInformationSection);
		
		beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("勘察开采");
		beanInformationSection.setDefaultUrl("front/baseInfoAction!findModule.action?moduletype=8");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(5);
		this.getBaseService().save(beanInformationSection);
		
		beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("人才频道");
		beanInformationSection.setDefaultUrl("front/baseInfoAction!findModule.action?moduletype=9");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(6);
		this.getBaseService().save(beanInformationSection);
		
		beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("港口动态");
		beanInformationSection.setDefaultUrl("front/baseInfoAction!findModule.action?moduletype=10");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(7);
		this.getBaseService().save(beanInformationSection);
		
		beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("专家栏目");
		beanInformationSection.setDefaultUrl("front/expertAction!findAll.action");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(8);
		this.getBaseService().save(beanInformationSection);
		
		beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("政策法规");
		beanInformationSection.setDefaultUrl("front/baseInfoAction!findModule.action?moduletype=12");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(9);
		this.getBaseService().save(beanInformationSection);
		
		beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("矿业知识");
		beanInformationSection.setDefaultUrl("front/baseInfoAction!findModule.action?moduletype=13");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(10);
		this.getBaseService().save(beanInformationSection);
		
		beanInformationSection = new BeanInformationSection();
		beanInformationSection.setTitle("自助广告");
		beanInformationSection.setDefaultUrl("front/selfAdvertAction!findAll.action");
		beanInformationSection.setImageUrl("content/skin/images/Navigation_s.gif");
		beanInformationSection.setSubscript(11);
		this.getBaseService().save(beanInformationSection);

	}

	// 初始化信息
	private void initInfo() throws TypeConvertException {
		// TODO Auto-generated method stub
		List<BeanInfoModule> m = this.getBaseService().findAll(BeanInfoModule.class);
		BeanUser u = this.getBaseService().findById(1l, BeanUser.class);
		for (int i = 0; i < m.size(); i++) {
			String mn = m.get(i).getModulename();
			String mt = m.get(i).getModuletype();
			List<BeanModuleColumn> c = m.get(i).getModuleColumns();
			for (int j = 0; j < c.size(); j++) {
				String cn = c.get(j).getColumnname();
				String ct = c.get(j).getColumntype();
				for (int k = 0; k < 5; k++) {
					if (mt.equals("11") && ct.equals("1")) {
						// nothing
					} else {
						BeanBaseInfo bean = new BeanBaseInfo();
						bean.setColumnname(cn);
						bean.setColumntype(ct);
						bean.setModulename(mn);
						bean.setModuletype(mt);
						bean.setTitle("title" + cn + k);
						bean.setContent("内容" + mn + cn);
						bean.setClicktime(new Random().nextInt(100));
						if (mt.equals("11") && ct.equals("2")) {
							bean.setExpert(u.getBeanExpert());
						}
						bean.setUser(u);
						bean.setStatus("已审核");
						bean.setCreatetime(new Timestamp(System.currentTimeMillis()));
						if (mt.equals("1")) {
							Map<String, String> map = new HashMap<String, String>();
							bean.setVariety("Fe" + i);
							map.put("price", "100");
							map.put("enterpricename", "云南昆明有限公司");
							map.put("eamil", "fu@128.com");
							map.put("fax", "0909-8841");
							bean.setProp(map);
						}
						if (mt.equals("3")) {
							Map<String, String> map = new HashMap<String, String>();
							if (ct.equals("3") || ct.equals("4")) {
								map.put("tradetime", TimestampTypeConverter.convertToString(new Timestamp(System.currentTimeMillis()), "yyyy-MM-dd"));
								map.put("upprice", "1000");
								map.put("downprice", "100");
								bean.setVariety("Fe" + i);
								bean.setProp(map);
							}
						}
						if (mt.equals("7")) {
							Map<String, String> map = new HashMap<String, String>();
							map.put("mineLocation", "云南昭通");
							bean.setProp(map);
						}
						if (mt.equals("9")) {
							Map<String, String> map = new HashMap<String, String>();
							map.put("provideposition", "招聘" + k);
							map.put("eamil", "fu@128.com");
							map.put("fax", "0909-8841");
							map.put("linkman", "yaoy");
							map.put("fax", "0909-8841");
							bean.setProp(map);
						}
						if (mt.equals("14")) {
							Map<String, String> map = new HashMap<String, String>();
							if (ct.equals("1")) {
								map.put("tradetime", TimestampTypeConverter.convertToString(new Timestamp(System.currentTimeMillis()), "yyyy-MM-dd"));
								map.put("upprice", "1000");
								map.put("downprice", "10001");
								bean.setProp(map);
								bean.setVariety("Fe" + i);
							} else if (ct.equals("2")) {
								map.put("tradetime", TimestampTypeConverter.convertToString(new Timestamp(System.currentTimeMillis()), "yyyy-MM-dd"));
								map.put("upprice", "1000");
								map.put("downprice", "10001");
								bean.setVariety("Fe" + i);
								bean.setProp(map);
							}
						}
						this.getBaseService().save(bean);
					}
				}
			}
		}
	}

	// 初始化模块时候的时候调用
	public void appendModule(BeanInfoModule bean) {
		// TODO Auto-generated method stub
		this.getBaseService().save(bean);

	}

	// 初始化模块和栏目
	private void initModule() {
		List<BeanModuleColumn> list = new ArrayList<BeanModuleColumn>();
		BeanInfoModule bean = new BeanInfoModule("供 求", "1");
		list.add(new BeanModuleColumn(bean, "供应信息", "1"));
		list.add(new BeanModuleColumn(bean, "求购信息", "2"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("资 讯", "2");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "国内资讯", "1"));
		list.add(new BeanModuleColumn(bean, "国际资讯", "2"));
		list.add(new BeanModuleColumn(bean, "行业快讯", "3"));
		list.add(new BeanModuleColumn(bean, "形式点评", "4"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("行 情", "3");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "行情指导", "1"));
		list.add(new BeanModuleColumn(bean, "热点聚焦", "2"));
		list.add(new BeanModuleColumn(bean, "企业原料报价", "3"));
		list.add(new BeanModuleColumn(bean, "企业成品报价", "4"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("招商引资", "4");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "招商政策", "1"));
		list.add(new BeanModuleColumn(bean, "招商信息 ", "2"));
		list.add(new BeanModuleColumn(bean, "合作开发", "3"));
		list.add(new BeanModuleColumn(bean, "转让出售", "4"));
		list.add(new BeanModuleColumn(bean, "招标项目", "5"));
		list.add(new BeanModuleColumn(bean, "加盟代理", "6"));
		list.add(new BeanModuleColumn(bean, "代理加工", "7"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("投资融资", "5");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "套期保值", "1"));
		list.add(new BeanModuleColumn(bean, "招商信息 ", "2"));
		list.add(new BeanModuleColumn(bean, "期货投资", "3"));
		list.add(new BeanModuleColumn(bean, "不动产", "4"));
		list.add(new BeanModuleColumn(bean, "组合投资", "5"));
		list.add(new BeanModuleColumn(bean, "特色服务", "6"));
		list.add(new BeanModuleColumn(bean, "融资服务", "7"));
		list.add(new BeanModuleColumn(bean, "融资招标", "8"));
		list.add(new BeanModuleColumn(bean, "投资招标 ", "9"));
		list.add(new BeanModuleColumn(bean, "合作", "10"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("矿业资源", "6");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "矿", "1"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("矿权信息", "7");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "矿权信息", "1"));
		list.add(new BeanModuleColumn(bean, "矿权合作 ", "2"));
		list.add(new BeanModuleColumn(bean, "矿权转让", "3"));
		list.add(new BeanModuleColumn(bean, "矿权招标 ", "4"));
		list.add(new BeanModuleColumn(bean, "矿权评估", "5"));
		list.add(new BeanModuleColumn(bean, "矿权代理 ", "6"));

		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("勘察开采", "8");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "安全评估", "1"));
		list.add(new BeanModuleColumn(bean, "环保 ", "2"));
		list.add(new BeanModuleColumn(bean, "寻找项目", "3"));
		list.add(new BeanModuleColumn(bean, "寻找勘察单位", "4"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("人才频道", "9");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "企业招聘 ", "1"));
		list.add(new BeanModuleColumn(bean, "人才求职", "2"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("港口动态", "10");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "港口新闻", "1"));
		list.add(new BeanModuleColumn(bean, "海运行情 ", "2"));
		list.add(new BeanModuleColumn(bean, "港口报价", "3"));
		list.add(new BeanModuleColumn(bean, "出口口岸报价", "4"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("专家栏目", "11");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "专家介绍", "1"));
		list.add(new BeanModuleColumn(bean, "专家文献 ", "2"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("政策法规", "12");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "国家政策法规", "1"));
		list.add(new BeanModuleColumn(bean, "地方政策法规 ", "2"));
		list.add(new BeanModuleColumn(bean, "办事指南", "3"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("矿业知识", "13");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "矿业设备及材料", "1"));
		list.add(new BeanModuleColumn(bean, "环保、安全知识 ", "2"));
		list.add(new BeanModuleColumn(bean, "矿业科技", "3"));
		list.add(new BeanModuleColumn(bean, "矿产品知识 ", "4"));
		list.add(new BeanModuleColumn(bean, "能源产品知识", "5"));
		list.add(new BeanModuleColumn(bean, "地质勘察知识", "6"));
		list.add(new BeanModuleColumn(bean, "矿业药剂知识", "7"));
		list.add(new BeanModuleColumn(bean, "其它", "8"));
		bean.setModuleColumns(list);
		appendModule(bean);

		bean = new BeanInfoModule("及时信息", "14");
		list = new ArrayList<BeanModuleColumn>();
		list.add(new BeanModuleColumn(bean, "期货行情", "1"));
		list.add(new BeanModuleColumn(bean, "现货行情", "2"));
		bean.setModuleColumns(list);
		appendModule(bean);
	}

	// 初始化信息评论
	private void initComment() {
		List<BeanBaseInfo> m = this.getBaseService().findAll(BeanBaseInfo.class);
		BeanUser u1 = this.getBaseService().findById(1, BeanUser.class);
		BeanUser u2 = this.getBaseService().findById(2, BeanUser.class);
		List<BeanInfoComment> comms = null;
		for (int i = 0; i < m.size(); i++) {
			comms = new ArrayList<BeanInfoComment>(0);
			BeanBaseInfo bean = m.get(i);
			for (int j = 0; j < 2; j++) {
				BeanInfoComment com = new BeanInfoComment();
				com.setContent("评论内容" + bean.getModulename() + "==" + bean.getColumnname());
				com.setCreatetime(new Timestamp(System.currentTimeMillis()));
				com.setUser(u2);
				com.setStatus("已审核");
				com.setReplystatus("未回复");
				com.setBaseinfo(bean);
				this.getBaseService().save(com);
			}
			bean.setInfoComments(comms);
			this.getBaseService().merge(bean);
		}
		List<BeanInfoComment> cl = this.getBaseService().findAll(BeanInfoComment.class);
		for (int i = 0; i < cl.size(); i++) {
			BeanInfoComment c = cl.get(i);
			BeanInfoReply r = null;
			for (int j = 0; j < 2; j++) {
				r = new BeanInfoReply();
				r.setComment(c);
				r.setUser(u1);
				r.setStatus("已审核");
				r.setCreatetime(new Timestamp(System.currentTimeMillis()));
				r.setContent("你说得真好");
				this.getBaseService().save(r);
			}

		}
	}

	/**
	 * 初始化超级管理员
	 */
	@SuppressWarnings("unchecked")
	private void initSuperAndmin() {
		if (this.getBaseService().findByProperty("superAdmin", 1, BeanAdmin.class).size() > 0) {
			return;
		}

		BeanPermission beanPermission = new BeanPermission();
		beanPermission.setGmp1(true);// 管理员管理
		beanPermission.setGmp2(true);// 管理员注册
		beanPermission.setGmp3(true);// 管理员级别管理
		beanPermission.setGmp4(true);// 管理员权限分配
		beanPermission.setGmp5(true);// 管理员操作日志
		beanPermission.setGmp6(true);// 管理员放银币

		// --------用户管理--um---------------
		beanPermission.setNmp1(true);// 网站用户管理
		beanPermission.setNmp2(true);// 网站用户级别管理
		beanPermission.setNmp3(true);// 网站用户经验值管理
		beanPermission.setNmp4(true);// 用户相册管理

		// ---------信息管理--im---------------
		beanPermission.setImp1(true);// 信息板块管理
		beanPermission.setImp2(true);// 发布信息
		beanPermission.setImp3(true);// 信息管理
		beanPermission.setImp4(true);// 信息审核设置
		beanPermission.setImp5(true);// 货品类别管理
		beanPermission.setImp6(true);// 期货行情管理
		beanPermission.setImp7(true);// 现货行情管理
		beanPermission.setImp8(true);// 矿业资源管理
		beanPermission.setImp9(true);// 矿业资源发布
		beanPermission.setImp10(true);// 专家管理
		beanPermission.setImp11(true);// 店铺空间模块信息管理
		beanPermission.setImp12(true);// 店铺留言管理
		beanPermission.setImp13(true);// 空间留言管理
		beanPermission.setImp14(true);// 发布站内信

		// ---------商城管理--sm-------------
		beanPermission.setSmp1(true);// 供求分类管理
		beanPermission.setSmp2(true);// 商品分类管理
		beanPermission.setSmp3(true);// 商品管理
		beanPermission.setSmp4(true);// 订单管理
		beanPermission.setSmp5(true);// 评价管理
		beanPermission.setSmp6(true);// 店铺货架设置
		beanPermission.setSmp7(true);// 信用等级管理
		beanPermission.setSmp8(true);// 信用等级评价积分
		beanPermission.setSmp9(true);// 店铺管理
		beanPermission.setSmp10(true);// 旺铺推荐管理
		beanPermission.setSmp11(true);// 旺铺推荐设置
		beanPermission.setSmp12(true);// 橱窗推荐设置
		beanPermission.setSmp13(true);// 求购管理
		beanPermission.setSmp14(true);// 商城公告管理
		beanPermission.setSmp15(true);// 发布商城公告

		// ---------网站管理--wm-------------
		beanPermission.setWmp1(true);// 参数设置
		beanPermission.setWmp2(true);// 网站公告管理
		beanPermission.setWmp3(true);// 关键字过滤
		beanPermission.setWmp4(true);// 区域管理
		beanPermission.setWmp5(true);// 投诉管理
		beanPermission.setWmp6(true);// 协议管理
		beanPermission.setWmp7(true);// 签署协议明细

		// ---------增值管理--zm-------------
		beanPermission.setZmp1(true);// 竞价加价幅度
		beanPermission.setZmp2(true);// 商城首页商品广告位竞价管理
		beanPermission.setZmp3(true);// 网站首页商品分类竞价管理
		beanPermission.setZmp4(true);// 信息竞价位管理
		beanPermission.setZmp5(true);// 信息竞价位竞价明细
		beanPermission.setZmp6(true);// 广告位竞价/免费/保留管理
		beanPermission.setZmp7(true);// 广告位竞价明细
		beanPermission.setZmp8(true);// 广告审核
		beanPermission.setZmp9(true);// 飘彩管理
		beanPermission.setZmp10(true);// 短信订阅管理
		beanPermission.setZmp11(true);// 短信订阅板块管理
		beanPermission.setZmp12(true);// 行情指导收费设置
		beanPermission.setZmp13(true);// 行情指导收费用户管理

		// ---------统计管理--cm-------------
		beanPermission.setCm1(true);// 网站/页面流量统计
		beanPermission.setCm2(true);// 商品交易统计
		beanPermission.setCm3(true);// 商品交易量排名统计
		beanPermission.setCm4(true);// 网站消费统计
		beanPermission.setCm5(true);// 会员充值统计
		beanPermission.setCm6(true);// 转账统计
		beanPermission.setCm7(true);// 金、银币交易统计
		beanPermission.setCm8(true);// 会员虚拟币统计
		beanPermission.setCm9(true);// 兑换统计
		beanPermission.setCm10(true);// 放出银币量统计
		beanPermission.setCm11(true);// 站内虚拟币统计
		beanPermission.setCm12(true);// 信息统计
		beanPermission.setCm13(true);// 黄页统计
		beanPermission.setCm14(true);// 黄、紫钻人数统计
		beanPermission.setCm15(true);// 会员活跃度统计
		beanPermission.setCm16(true);// 会员等级统计

		// ---------装扮管理-bm-------------
		beanPermission.setBmp1(true);// 装扮类型管理
		beanPermission.setBmp2(true);// 装扮内容管理
		beanPermission.setBmp3(true);// 自定义模块价格设置
		beanPermission.setBmp4(true);// 背景自定义管理
		beanPermission.setBmp5(true);// 背景自定义图片审核
		beanPermission.setBmp6(true);// 店铺空间风格管理
		beanPermission.setBmp7(true);// 空间黄钻管理
		beanPermission.setBmp8(true);// 店铺紫钻管理

		// ---------黄页管理-hm-------------
		beanPermission.setHmp1(true);// 添加企业
		beanPermission.setHmp2(true);// 企业管理

		// ---------友情链接-ym-------------
		beanPermission.setYmp1(true);// 友情链接管理

		// ---------自助广告-pm-------------
		beanPermission.setPmp1(true);// 文字广告管理
		beanPermission.setPmp2(true);// 图片广告管理

		// ---------汇率管理-lm-------------
		beanPermission.setLmp1(true);// 积分兑银币汇率管理
		beanPermission.setLmp2(true);// 人民币兑金币汇率管理
		beanPermission.setLmp3(true);// 银币折扣管理
		this.getBaseService().save(beanPermission);

		BeanAdminLevel bean = new BeanAdminLevel();
		bean.setLevelname("超级管理员级别");
		bean.setLevelcode("0000");
		bean.setRemark("系统自动生成超级管理员级别");
		this.getBaseService().save(bean);

		BeanAdmin beanAdmin = new BeanAdmin();
		beanAdmin.setAdminname("超级管理员");
		beanAdmin.setAdminLoginName("admin");
		beanAdmin.setAdminpassword(MD5Util.md5Encrypt("admin"));
		beanAdmin.setRemark("系统自动生成超级管理员");
		beanAdmin.setState("正常");
		beanAdmin.setSuperAdmin(1);
		this.getBaseService().save(beanAdmin);

		// -----------
		bean.setPermission(beanPermission);
		this.getBaseService().saveOrUpdate(bean, BeanAdminLevel.class);

		beanAdmin.setAdminLevel(bean);
		this.getBaseService().saveOrUpdate(beanAdmin, BeanAdmin.class);

		Set admins = new HashSet<BeanAdmin>();
		admins.add(beanAdmin);
		bean.setAdmins(admins);
		this.getBaseService().saveOrUpdate(bean, BeanAdminLevel.class);

		/*
		 * Set admins = new HashSet<BeanAdmin>(); admins.add(beanAdmin);
		 * bean.setPermission(beanPermission);
		 * adminLevelService.save(beanPermission);
		 * 
		 * beanAdmin.setAdminLevel(bean); adminService.merge(beanAdmin);
		 */

	}

	/**
	 * 初始化网站用户
	 * 
	 */
	private void initBeanUserExperience() {
		// 初始化网站用户经验值管理
		BeanUserExperiences beanUserExperiences = new BeanUserExperiences();
		beanUserExperiences.setType(1);
		this.getBaseService().save(beanUserExperiences);

		// 初始化网站用户级别管理
		BeanUserExperiences beanUserExperiencesLevel = new BeanUserExperiences();
		this.getBaseService().save(beanUserExperiencesLevel);
		BeanUserLevel bean = new BeanUserLevel();
		bean.setLevelname("普通会员");
		bean.setBeanUserExperiences(beanUserExperiencesLevel);
		bean.setCreatetime(new Timestamp(System.currentTimeMillis()));
		bean.setRemark("系统自动生成");
		bean.setStartnumber(0);
		bean.setEndnumber(100);
		getBaseService().save(bean);

		beanUserExperiencesLevel = new BeanUserExperiences();
		this.getBaseService().save(beanUserExperiencesLevel);
		bean = new BeanUserLevel();
		bean.setLevelname("铜卡会员");
		bean.setBeanUserExperiences(beanUserExperiencesLevel);
		bean.setCreatetime(new Timestamp(System.currentTimeMillis()));
		bean.setRemark("系统自动生成");
		bean.setStartnumber(101);
		bean.setEndnumber(200);
		getBaseService().save(bean);

		beanUserExperiencesLevel = new BeanUserExperiences();
		this.getBaseService().save(beanUserExperiencesLevel);
		bean = new BeanUserLevel();
		bean.setLevelname("银卡会员");
		bean.setBeanUserExperiences(beanUserExperiencesLevel);
		bean.setCreatetime(new Timestamp(System.currentTimeMillis()));
		bean.setRemark("系统自动生成");
		bean.setStartnumber(201);
		bean.setEndnumber(300);
		getBaseService().save(bean);

		beanUserExperiencesLevel = new BeanUserExperiences();
		this.getBaseService().save(beanUserExperiencesLevel);
		bean = new BeanUserLevel();
		bean.setLevelname("金卡会员");
		bean.setBeanUserExperiences(beanUserExperiencesLevel);
		bean.setCreatetime(new Timestamp(System.currentTimeMillis()));
		bean.setRemark("系统自动生成");
		bean.setStartnumber(301);
		bean.setEndnumber(400);
		getBaseService().save(bean);

		beanUserExperiencesLevel = new BeanUserExperiences();
		this.getBaseService().save(beanUserExperiencesLevel);
		bean = new BeanUserLevel();
		bean.setLevelname("钻石会员");
		bean.setBeanUserExperiences(beanUserExperiencesLevel);
		bean.setCreatetime(new Timestamp(System.currentTimeMillis()));
		bean.setRemark("系统自动生成");
		bean.setStartnumber(401);
		bean.setEndnumber(500);
		getBaseService().save(bean);

		beanUserExperiencesLevel = new BeanUserExperiences();
		this.getBaseService().save(beanUserExperiencesLevel);
		bean = new BeanUserLevel();
		bean.setLevelname("VIP会员");
		bean.setBeanUserExperiences(beanUserExperiencesLevel);
		bean.setCreatetime(new Timestamp(System.currentTimeMillis()));
		bean.setRemark("系统自动生成");
		bean.setStartnumber(501);
		bean.setEndnumber(600);
		getBaseService().save(bean);

		// 初始化普通用户
		for (int i = 0; i < 25; i++) {
			BeanUser user = new BeanUser();
			BeanFinancialAccount beanAccount = new BeanFinancialAccount();
			beanAccount.setSilver(100);
			beanAccount.setGold(10000);
			beanAccount.setIntegral(1000);
			this.getBaseService().save(beanAccount);
			user.setFinancialAccount(beanAccount);

			user.setUsername("测试会员" + i);
			user.setUserLevel(this.getBaseService().findById(1L, BeanUserLevel.class));
			user.setUserLoginName("user" + i);
			user.setNikeName("呢称" + 1);
			user.setRegistDateTime(new Timestamp(System.currentTimeMillis()));
			user.setRegistIP(ServletActionContext.getRequest().getRemoteAddr());
			user.setUserpassword("123");
			user.setAccountType(0);
			user.setExperience(0);
			user.setCreditScore(0);

			BeanUserPersonal personal = new BeanUserPersonal();
			personal.setSex("男");
			personal.setAge(25);
			personal.setQq(i + "8888888888");
			personal.setSignature(i + "我的地盘我做言主");
			personal.setEmail(i + "etest1lxj081" + i + "@163.com");
			personal.setRealName(i + "李子");
			personal.setBirthday(new Date());
			personal.setMobilephone(i + "15387625394");
			personal.setTelephone("0871-3383883");
			personal.setAddress(i + "昆明白云路翡翠湾7-2203");
			personal.setProvince("云南");
			personal.setCity("昆明");
			personal.setZipCode(i + "58904");
			personal.setIdNumber(i + "5323242767594949X");
			personal.setImgUrl("images/user_ico_image.png");

			user.setPersonal(personal);

			BeanShoppingCart shoppingCart = new BeanShoppingCart();
			this.getBaseService().save(shoppingCart);
			user.setShoppingCart(shoppingCart);
			user.setVerificationEmail(true);
			insetBBSUser(user);
			user.setUserpassword(MD5Util.md5Encrypt(user.getUserpassword()));
			this.getBaseService().save(user);
		}
		// 初始化专家
		List<BeanUser> ul = this.getBaseService().findAll(BeanUser.class);
		for (int i = 0; i < ul.size(); i++) {
			BeanUser user = new BeanUser();
			BeanFinancialAccount beanAccount = new BeanFinancialAccount();
			beanAccount.setSilver(100);
			beanAccount.setGold(10000);
			beanAccount.setIntegral(1000);
			this.getBaseService().save(beanAccount);
			user.setFinancialAccount(beanAccount);

			user.setUsername("测试专家" + i);
			user.setUserLevel(this.getBaseService().findById(1L, BeanUserLevel.class));
			user.setUserLoginName("zuser" + i);
			user.setNikeName("专家呢称" + 1);
			user.setRegistDateTime(new Timestamp(System.currentTimeMillis()));
			user.setRegistIP(ServletActionContext.getRequest().getRemoteAddr());
			user.setUserpassword("123");
			user.setAccountType(0);
			user.setExperience(0);
			user.setCreditScore(0);

			BeanUserPersonal personal = new BeanUserPersonal();
			personal.setSex("男");
			personal.setAge(25);
			personal.setQq(i + "8888888888");
			personal.setSignature(i + "我的地盘我做言主");
			personal.setEmail(i + "etest1lxj081" + i + "@163.com");
			personal.setRealName(i + "李子");
			personal.setBirthday(new Date());
			personal.setMobilephone(i + "15387625394");
			personal.setTelephone("0871-3383883");
			personal.setAddress(i + "昆明白云路翡翠湾7-2203");
			personal.setProvince("云南");
			personal.setCity("昆明");
			personal.setZipCode(i + "58904");
			personal.setIdNumber(i + "5323242767594949X");
			personal.setImgUrl("images/user_ico_image.png");

			user.setPersonal(personal);

			user.setExpert(true);
			user.setVerificationEmail(true);
			insetBBSUser(user);
			user.setUserpassword(MD5Util.md5Encrypt(user.getUserpassword()));
			this.getBaseService().save(user);

			BeanExpert beanExpert = new BeanExpert("冶金", user.getUsername(), new Timestamp(System.currentTimeMillis()), "博士", "专家", "荣誉市民", "北京", "科学院", "00010001", "44345362", "ymis@127.com", "冶金", "专家", "出色的", "/images/8.png");
			beanExpert.setUser(user);
			this.getBaseService().save(beanExpert);

		}

		// 初始化企业用户
		for (int i = 0; i < 25; i++) {
			BeanUser user = new BeanUser();
			BeanFinancialAccount beanAccount = new BeanFinancialAccount();
			beanAccount.setSilver(100);
			beanAccount.setGold(10000);
			beanAccount.setIntegral(1000);
			this.getBaseService().save(beanAccount);
			user.setFinancialAccount(beanAccount);

			BeanUserPersonal personal = new BeanUserPersonal();
			personal.setSex("男");
			personal.setAge(25);
			personal.setQq(i + "8888888888");
			personal.setSignature(i + "我的地盘我做言主");
			personal.setEmail(i + "etest1lxj081" + i + "@163.com");
			personal.setRealName(i + "李子");
			personal.setBirthday(new Date());
			personal.setMobilephone(i + "15387625394");
			personal.setTelephone("0871-3383883");
			personal.setAddress(i + "昆明白云路翡翠湾7-2203");
			personal.setProvince("云南");
			personal.setCity("昆明");
			personal.setZipCode(i + "58904");
			personal.setIdNumber(i + "5323242767594949X");

			personal.setCompanyName("云南海鼎科技有限公司");
			personal.setCompanyAddress(i + "昆明白云路翡翠湾7-2203");
			personal.setCompanyProvince("云南");
			personal.setCompanyCity("昆明");
			personal.setCompanyZipCode("675849");
			personal.setCompanyBusiness(i + "IT 软件开发");
			personal.setCompanyWebsite(i + "www.baidu.com");
			personal.setCompanyEmail(i + "lxj08193@163.com");
			personal.setCompanyLogo(i + "还没有Logo");
			personal.setCompanyContact(i + "杨");
			personal.setCompanyExtent("50人");
			personal.setCompanyTelephone("0871-332224");

			personal.setImgUrl("images/conpany_ico_image.png");
			user.setPersonal(personal);

			user.setUsername("企业测试会员" + i);
			user.setUserLevel(this.getBaseService().findById(1L, BeanUserLevel.class));
			user.setUserLoginName("euser" + i);
			user.setNikeName("呢称" + 1);
			user.setRegistDateTime(new Timestamp(System.currentTimeMillis()));
			user.setRegistIP(ServletActionContext.getRequest().getRemoteAddr());
			user.setUserpassword("123");
			user.setAccountType(1);
			user.setExperience(0);
			user.setCreditScore(0);

			BeanEnterprise enterprise = new BeanEnterprise();
			enterprise.setAddress(i + "昆明白云路翡翠湾7-2203");
			enterprise.setName(i + "云南海鼎科技有限公司");
			enterprise.setIntroduce(i + "互联网   IT 软件开发 、实施， 解决方案提供商");
			enterprise.setNotice(i + "公告公告");
			enterprise.setContactPeople(i + "杨");
			enterprise.setBusinessScope("软件开发 、实施， 解决方案提供");
			enterprise.setEmail("XXXXXXX@163.com");
			enterprise.setSiteUrl("www.baidu.com");
			enterprise.setCompanyExtent("50人以下");
			enterprise.setBriefIntroduce("互联网   IT 软件开发 、实施， 解决方案提供商");

			enterprise.setBusinessScope(i + "服务器");

			this.getBaseService().save(enterprise);
			user.setEnterprise(enterprise);

			BeanEnterpriseZone enterpriseZone = new BeanEnterpriseZone();
			enterpriseZone.setName(i + "我的企业空间XXX");
			this.getBaseService().save(enterpriseZone);
			BeanEnterpriseZoneDecorate ezoneDecorate = new BeanEnterpriseZoneDecorate();
			enterpriseZone.setEzoneDecorate(ezoneDecorate);
			user.setEnterpriseZone(enterpriseZone);

			BeanShop shop = new BeanShop();
			shop.setName(user.getUsername() + "的小店");
			if (i % 4 == 1) {
				shop.setIconUrl("content/initimg/11.gif");
			} else if (i % 4 == 2) {
				shop.setIconUrl("content/initimg/12.png");
			} else if (i % 4 == 3) {
				shop.setIconUrl("content/initimg/13.jpg");
			} else if (i % 4 == 0) {
				shop.setIconUrl("content/initimg/14.jpg");
			}

			BeanGoodShowcase showcase = new BeanGoodShowcase();
			showcase.setQuantity(10);
			shop.setShowcase(showcase);
			this.getBaseService().save(shop);
			BeanShelf shelf = new BeanShelf();
			shelf.setShop(shop);
			shelf.setQuantity(10);
			this.getBaseService().save(shelf);
			user.setShop(shop);

			BeanShoppingCart shoppingCart = new BeanShoppingCart();
			this.getBaseService().save(shoppingCart);
			user.setShoppingCart(shoppingCart);

			// enterprise.set
			user.setAccountType(1);
			user.setVerificationEmail(true);
			insetBBSUser(user);
			user.setUserpassword(MD5Util.md5Encrypt(user.getUserpassword()));
			this.getBaseService().save(user);

		}
	}

	public void insetBBSUser(BeanUser user) {
		/*
		 * SimpleDateFormat dateFormat = new
		 * SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateTime =
		 * dateFormat.format(new Date(System.currentTimeMillis())); String sex =
		 * "U"; String ip = ServletActionContext.getRequest().getRemoteAddr();
		 * if (user.getPersonal().getSex().equals("男")) { sex = "M"; } else if
		 * (user.getPersonal().getSex().equals("女")) { sex = "F"; } String sql =
		 * "INSERT INTO `ejf_user` VALUES ('" + user.getUserLoginName() + "','"
		 * + user.getUsername() + "','" +
		 * BBSMD5.MD5(BBSMD5.MD5(user.getUserpassword())) + "','" +
		 * user.getPersonal().getEmail() + "','" + user.getPersonal().getQq() +
		 * "','" + sex + "',NULL,'U','1970-01-01',NULL,'" + ip +
		 * "',NULL,'F',0,0,0,'1','" + dateTime + "',1,0,NULL,NULL,'N','" +
		 * dateTime + "','" + dateTime + "')";
		 * this.getBaseService().getBaseDao()
		 * .getSession().createSQLQuery(sql).executeUpdate();
		 */}

	private void initMall() {
		initGoodType();
		initEvaluateType();
		initCreditRating();
	}

	private IBeanTypeService typeService;

	@Resource
	public void setTypeService(IBeanTypeService typeService) {
		this.typeService = typeService;
	}

	private void initGoodType() {
		BeanType goodType = typeService.getRootRecursive(IBeanTypeService.Constants.ROOT_NAME_OF_GOOD);

		if (goodType.getChildren() == null || goodType.getChildren().size() == 0) {
			BeanType 有色金属 = typeService.createType(goodType.getId(), "有色金属");

			BeanType 重有色 = typeService.createType(有色金属.getId(), "重有色");
			BeanType 轻有色 = typeService.createType(有色金属.getId(), "轻有色");
			BeanType 贵金属 = typeService.createType(有色金属.getId(), "贵金属");
			BeanType 半金属 = typeService.createType(有色金属.getId(), "半金属");
			BeanType 稀土金属 = typeService.createType(有色金属.getId(), "稀土金属");
			BeanType 稀有轻 = typeService.createType(有色金属.getId(), "稀有轻");
			BeanType 高熔点金属 = typeService.createType(有色金属.getId(), "高熔点金属");
			BeanType 放射性金属 = typeService.createType(有色金属.getId(), "放射性金属");
			BeanType 稀散金属 = typeService.createType(有色金属.getId(), "稀散金属");

			typeService.createType(重有色.getId(), "铜");
			typeService.createType(重有色.getId(), "镍");
			typeService.createType(重有色.getId(), "锢");
			typeService.createType(重有色.getId(), "铅");
			typeService.createType(重有色.getId(), "锌");

			typeService.createType(轻有色.getId(), "锑");
			typeService.createType(轻有色.getId(), "汞");
			typeService.createType(轻有色.getId(), "镉");
			typeService.createType(轻有色.getId(), "铋");
			typeService.createType(轻有色.getId(), "铝");
			typeService.createType(轻有色.getId(), "镁");

			typeService.createType(贵金属.getId(), "钙");
			typeService.createType(贵金属.getId(), "钾");
			typeService.createType(贵金属.getId(), "锶");
			typeService.createType(贵金属.getId(), "钡");
			typeService.createType(贵金属.getId(), "钯");
			typeService.createType(贵金属.getId(), "铂");

			typeService.createType(半金属.getId(), "铱");
			typeService.createType(半金属.getId(), "铹");
			typeService.createType(半金属.getId(), "锇");
			typeService.createType(半金属.getId(), "釕");
			typeService.createType(半金属.getId(), "鈹");
			typeService.createType(半金属.getId(), "金");

			typeService.createType(稀土金属.getId(), "银");
			typeService.createType(稀土金属.getId(), "硅");
			typeService.createType(稀土金属.getId(), "硒");
			typeService.createType(稀土金属.getId(), "碲");
			typeService.createType(稀土金属.getId(), "砷");
			typeService.createType(稀土金属.getId(), "硼");

			typeService.createType(稀有轻.getId(), "锂");
			typeService.createType(稀有轻.getId(), "铍");
			typeService.createType(稀有轻.getId(), "铷");
			typeService.createType(稀有轻.getId(), "铯");
			typeService.createType(稀有轻.getId(), "钨");
			typeService.createType(稀有轻.getId(), "钼");
			typeService.createType(稀有轻.getId(), "钽");
			typeService.createType(稀有轻.getId(), "锆");
			typeService.createType(稀有轻.getId(), "钒");

			typeService.createType(高熔点金属.getId(), "钛");
			typeService.createType(高熔点金属.getId(), "铼");
			typeService.createType(高熔点金属.getId(), "镓");
			typeService.createType(高熔点金属.getId(), "铟");
			typeService.createType(高熔点金属.getId(), "铊");
			typeService.createType(高熔点金属.getId(), "铌");

			typeService.createType(放射性金属.getId(), "锗");
			typeService.createType(放射性金属.getId(), "硒");
			typeService.createType(放射性金属.getId(), "碲");
			typeService.createType(放射性金属.getId(), "镧");
			typeService.createType(放射性金属.getId(), "铈");
			typeService.createType(放射性金属.getId(), "镨");
			typeService.createType(放射性金属.getId(), "钕");
			typeService.createType(放射性金属.getId(), "钷");
			typeService.createType(放射性金属.getId(), "钐");

			typeService.createType(稀散金属.getId(), "铕");
			typeService.createType(稀散金属.getId(), "钆");
			typeService.createType(稀散金属.getId(), "铽");
			typeService.createType(稀散金属.getId(), "镝");
			typeService.createType(稀散金属.getId(), "钐");
			typeService.createType(稀散金属.getId(), "钐");

			BeanType 黑色金属 = typeService.createType(goodType.getId(), "黑色金属");

			BeanType 铁 = typeService.createType(黑色金属.getId(), "铁");
			// BeanType 锰 =
			typeService.createType(黑色金属.getId(), "锰");
			// BeanType 铬 =
			typeService.createType(黑色金属.getId(), "铬");

			typeService.createType(铁.getId(), "镁磁铁矿");
			typeService.createType(铁.getId(), "镜铁矿");
			typeService.createType(铁.getId(), "钛铁矿");
			typeService.createType(铁.getId(), "钒铁矿");
			typeService.createType(铁.getId(), "磁铁矿");
			typeService.createType(铁.getId(), "褐铁矿");
			typeService.createType(铁.getId(), "菱铁矿");
			typeService.createType(铁.getId(), "硫化铁矿");
			typeService.createType(铁.getId(), "铬铁矿");
			typeService.createType(铁.getId(), "赤铁矿");
			typeService.createType(铁.getId(), "钨铁矿");
			BeanType 非金属矿产 = typeService.createType(goodType.getId(), "非金属矿产");
			// BeanType 能源 =
			typeService.createType(非金属矿产.getId(), "能源");
			// BeanType 玻璃工业 =
			typeService.createType(非金属矿产.getId(), "玻璃工业");
			// BeanType 陶瓷工业 =
			typeService.createType(非金属矿产.getId(), "陶瓷工业");
			// BeanType 冶金工业 =
			typeService.createType(非金属矿产.getId(), "冶金工业");
			// BeanType 废金属 =
			typeService.createType(goodType.getId(), "废金属");
			// BeanType 水气矿产 =
			typeService.createType(goodType.getId(), "水气矿产");
			// BeanType 矿业设备及材料 =
			typeService.createType(goodType.getId(), "矿业设备及材料");
			// BeanType 矿业药剂 =
			typeService.createType(goodType.getId(), "矿业药剂");
			// BeanType 矿业书籍 =
			typeService.createType(goodType.getId(), "矿业书籍");
			// BeanType 办公用品 =
			typeService.createType(goodType.getId(), "办公用品");
			// BeanType 数码产品 =
			typeService.createType(goodType.getId(), "数码产品");
			// BeanType 钢材相关 =
			typeService.createType(goodType.getId(), "钢材相关");
			// BeanType 五金相关 =
			typeService.createType(goodType.getId(), "五金相关");
			// BeanType 矿用工具 =
			typeService.createType(goodType.getId(), "矿用工具");
			// BeanType 设计制作 =
			typeService.createType(goodType.getId(), "设计制作");

		}
	}

	private IBeanEvaluateTypeService evaluateTypeService;

	@Resource
	public void setEvaluateTypeService(IBeanEvaluateTypeService evaluateTypeService) {
		this.evaluateTypeService = evaluateTypeService;
	}

	private void initEvaluateType() {
		BeanEvaluateType type = new BeanEvaluateType();
		type.setName("好评");
		type.setOrdinal(1);
		type.setScore(1);

		evaluateTypeService.save(type);

		type = new BeanEvaluateType();
		type.setName("中评");
		type.setOrdinal(2);
		type.setScore(0);

		evaluateTypeService.save(type);

		type = new BeanEvaluateType();
		type.setName("差评");
		type.setOrdinal(3);
		type.setScore(-1);

		evaluateTypeService.save(type);
	}

	private IBeanCreditRatingService creditRatingService;

	@Resource
	public void setCreditRatingService(IBeanCreditRatingService creditRatingService) {
		this.creditRatingService = creditRatingService;
	}

	private void initCreditRating() {
		BeanCreditRating creditRating = null;

		// 1
		creditRating = new BeanCreditRating();
		creditRating.setName("一星");
		creditRating.setImgUrl("content/skin/mall/Seller/1.gif");
		creditRating.setOrdinal(1);
		creditRating.setScoreIntervalLower(0);
		creditRating.setScoreIntervalUpper(10);
		creditRatingService.save(creditRating);

		// 2
		creditRating = new BeanCreditRating();
		creditRating.setName("二星");
		creditRating.setImgUrl("content/skin/mall/Seller/2.gif");
		creditRating.setOrdinal(2);
		creditRating.setScoreIntervalLower(11);
		creditRating.setScoreIntervalUpper(40);
		creditRatingService.save(creditRating);

		// 3
		creditRating = new BeanCreditRating();
		creditRating.setName("三星");
		creditRating.setImgUrl("content/skin/mall/Seller/3.gif");
		creditRating.setOrdinal(3);
		creditRating.setScoreIntervalLower(41);
		creditRating.setScoreIntervalUpper(90);
		creditRatingService.save(creditRating);

		// 4
		creditRating = new BeanCreditRating();
		creditRating.setName("四星");
		creditRating.setImgUrl("content/skin/mall/Seller/4.gif");
		creditRating.setOrdinal(4);
		creditRating.setScoreIntervalLower(91);
		creditRating.setScoreIntervalUpper(150);
		creditRatingService.save(creditRating);

		// 5
		creditRating = new BeanCreditRating();
		creditRating.setName("五星");
		creditRating.setImgUrl("content/skin/mall/Seller/5.gif");
		creditRating.setOrdinal(5);
		creditRating.setScoreIntervalLower(151);
		creditRating.setScoreIntervalUpper(250);
		creditRatingService.save(creditRating);

		// 6
		creditRating = new BeanCreditRating();
		creditRating.setName("一钻");
		creditRating.setImgUrl("content/skin/mall/Seller/6.gif");
		creditRating.setOrdinal(6);
		creditRating.setScoreIntervalLower(251);
		creditRating.setScoreIntervalUpper(500);
		creditRatingService.save(creditRating);

		// 7
		creditRating = new BeanCreditRating();
		creditRating.setName("二钻");
		creditRating.setImgUrl("content/skin/mall/Seller/7.gif");
		creditRating.setOrdinal(7);
		creditRating.setScoreIntervalLower(501);
		creditRating.setScoreIntervalUpper(1000);
		creditRatingService.save(creditRating);

		// 8
		creditRating = new BeanCreditRating();
		creditRating.setName("三钻");
		creditRating.setImgUrl("content/skin/mall/Seller/8.gif");
		creditRating.setOrdinal(8);
		creditRating.setScoreIntervalLower(1001);
		creditRating.setScoreIntervalUpper(2000);
		creditRatingService.save(creditRating);

		// 9
		creditRating = new BeanCreditRating();
		creditRating.setName("四钻");
		creditRating.setImgUrl("content/skin/mall/Seller/9.gif");
		creditRating.setOrdinal(9);
		creditRating.setScoreIntervalLower(2001);
		creditRating.setScoreIntervalUpper(5000);
		creditRatingService.save(creditRating);

		// 10
		creditRating = new BeanCreditRating();
		creditRating.setName("五钻");
		creditRating.setImgUrl("content/skin/mall/Seller/10.gif");
		creditRating.setOrdinal(10);
		creditRating.setScoreIntervalLower(5001);
		creditRating.setScoreIntervalUpper(10000);
		creditRatingService.save(creditRating);

		// 11
		creditRating = new BeanCreditRating();
		creditRating.setName("一冠");
		creditRating.setImgUrl("content/skin/mall/Seller/11.gif");
		creditRating.setOrdinal(11);
		creditRating.setScoreIntervalLower(10001);
		creditRating.setScoreIntervalUpper(20000);
		creditRatingService.save(creditRating);

		// 12
		creditRating = new BeanCreditRating();
		creditRating.setName("二冠");
		creditRating.setImgUrl("content/skin/mall/Seller/12.gif");
		creditRating.setOrdinal(12);
		creditRating.setScoreIntervalLower(20001);
		creditRating.setScoreIntervalUpper(50000);
		creditRatingService.save(creditRating);

		// 13
		creditRating = new BeanCreditRating();
		creditRating.setName("三冠");
		creditRating.setImgUrl("content/skin/mall/Seller/13.gif");
		creditRating.setOrdinal(13);
		creditRating.setScoreIntervalLower(50001);
		creditRating.setScoreIntervalUpper(100000);
		creditRatingService.save(creditRating);

		// 14
		creditRating = new BeanCreditRating();
		creditRating.setName("四冠");
		creditRating.setImgUrl("content/skin/mall/Seller/14.gif");
		creditRating.setOrdinal(14);
		creditRating.setScoreIntervalLower(100001);
		creditRating.setScoreIntervalUpper(200000);
		creditRatingService.save(creditRating);

		// 15
		creditRating = new BeanCreditRating();
		creditRating.setName("五冠");
		creditRating.setImgUrl("content/skin/mall/Seller/15.gif");
		creditRating.setOrdinal(15);
		creditRating.setScoreIntervalLower(200001);
		creditRating.setScoreIntervalUpper(500000);
		creditRatingService.save(creditRating);

	}

	private void initDecorate() {
		initDecorateLayout();
		initDecorateModule();
		initStyle();
	}

	private IBeanLayoutService layoutService;

	@Resource
	public void setLayoutService(IBeanLayoutService layoutService) {
		this.layoutService = layoutService;
	}

	private void initDecorateLayout() {
		BeanLayout temp = null;
		BeanLayout childTemp = null;

		temp = new BeanLayout();
		temp.setExpandDirection("left-right");
		temp.setChildren(new ArrayList<BeanLayout>());

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(1);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(3);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		layoutService.save(temp);
		// 1:3--------------------end

		temp = new BeanLayout();
		temp.setExpandDirection("left-right");
		temp.setChildren(new ArrayList<BeanLayout>());

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(3);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(1);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		layoutService.save(temp);
		// 3:1--------------------end

		temp = new BeanLayout();
		temp.setExpandDirection("left-right");
		temp.setChildren(new ArrayList<BeanLayout>());

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(1);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(4);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		layoutService.save(temp);
		// 1:4--------------------end

		temp = new BeanLayout();
		temp.setExpandDirection("left-right");
		temp.setChildren(new ArrayList<BeanLayout>());

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(4);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(1);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		layoutService.save(temp);
		// 4:1--------------------end

		temp = new BeanLayout();
		temp.setExpandDirection("left-right");
		temp.setChildren(new ArrayList<BeanLayout>());

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(2);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(3);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		layoutService.save(temp);
		// 2:3--------------------end

		temp = new BeanLayout();
		temp.setExpandDirection("left-right");
		temp.setChildren(new ArrayList<BeanLayout>());

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(3);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(2);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		layoutService.save(temp);
		// 2:3--------------------end

		temp = new BeanLayout();
		temp.setExpandDirection("left-right");
		temp.setChildren(new ArrayList<BeanLayout>());

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(2);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(2);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		layoutService.save(temp);
		// 2:2--------------------end

		temp = new BeanLayout();
		temp.setExpandDirection("left-right");
		temp.setChildren(new ArrayList<BeanLayout>());

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(1);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(3);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		childTemp = new BeanLayout();
		childTemp.setExpandProportion(1);
		childTemp.setExpandDirection("top-buttom");
		childTemp.setParent(temp);
		temp.getChildren().add(childTemp);

		layoutService.save(temp);
		// 1:3:1--------------------end

	}

	private IBeanModuleService moduleService;

	@Resource
	public void setModuleService(IBeanModuleService moduleService) {
		this.moduleService = moduleService;
	}

	private void initDecorateModule() {
		BeanModule temp = null;
		Map<String, String> properties = null;

		temp = new BeanModule();
		properties = new HashMap<String, String>();
		temp.setName("卖家信息");
		temp.setProperties(properties);
		properties.put("path", "module/sellerInfo.jsp");
		moduleService.save(temp);

		temp = new BeanModule();
		properties = new HashMap<String, String>();
		temp.setName("商品分类");
		temp.setProperties(properties);
		properties.put("path", "module/innerType.jsp");
		moduleService.save(temp);

		temp = new BeanModule();
		properties = new HashMap<String, String>();
		temp.setName("店内商品搜索");
		temp.setProperties(properties);
		properties.put("path", "module/searcher.jsp");
		moduleService.save(temp);

		temp = new BeanModule();
		properties = new HashMap<String, String>();
		temp.setName("最近访客");
		temp.setProperties(properties);
		properties.put("path", "module/visitor.jsp");
		moduleService.save(temp);

		temp = new BeanModule();
		properties = new HashMap<String, String>();
		temp.setName("友情链接");
		temp.setProperties(properties);
		properties.put("path", "module/friend.jsp");
		moduleService.save(temp);

		temp = new BeanModule();
		properties = new HashMap<String, String>();
		temp.setName("推荐商品");
		temp.setProperties(properties);
		properties.put("path", "module/showcase.jsp");
		moduleService.save(temp);

		temp = new BeanModule();
		properties = new HashMap<String, String>();
		temp.setName("我的商品");
		temp.setProperties(properties);
		properties.put("path", "module/shelf.jsp");
		moduleService.save(temp);

		temp = new BeanModule();
		properties = new HashMap<String, String>();
		temp.setName("店铺留言");
		temp.setProperties(properties);
		properties.put("path", "module/comment.jsp");
		moduleService.save(temp);
	}

	private IBeanStyleService styleService;

	@Resource
	public void setStyleService(IBeanStyleService styleService) {
		this.styleService = styleService;
	}

	private void initStyle() {
		BeanStyle temp = null;

		temp = new BeanStyle();
		temp.setName("1");
		styleService.save(temp);

		temp = new BeanStyle();
		temp.setName("2");
		styleService.save(temp);

		temp = new BeanStyle();
		temp.setName("3");
		styleService.save(temp);

		temp = new BeanStyle();
		temp.setName("4");
		styleService.save(temp);

		temp = new BeanStyle();
		temp.setName("5");
		styleService.save(temp);

		temp = new BeanStyle();
		temp.setName("6");
		styleService.save(temp);

		temp = new BeanStyle();
		temp.setName("7");
		styleService.save(temp);

		temp = new BeanStyle();
		temp.setName("8");
		styleService.save(temp);

		temp = new BeanStyle();
		temp.setName("9");
		styleService.save(temp);

		temp = new BeanStyle();
		temp.setName("10");
		styleService.save(temp);
	}

	private IBeanExperienceAndIntegralCountService experienceAndIntegralCountService;

	@Resource
	public void setExperienceAndIntegralCountService(IBeanExperienceAndIntegralCountService experienceAndIntegralCountService) {
		this.experienceAndIntegralCountService = experienceAndIntegralCountService;
	}

	private void initBeanExperienceAndIntegralCount() {

		// ---------------会员状态类--------------------
		// 注册成为会员，BeanUser
		BeanExperienceAndIntegralCount bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userStateC1");
		bean.setRefTable(BeanUser.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("id");
		bean.setRefTableQuantityColumn("1");
		experienceAndIntegralCountService.save(bean);

		// 登陆网站，BeanUserLoginLog
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userStateC2");
		bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("user_id");
		bean.setRefTableQuantityColumn("1");
		experienceAndIntegralCountService.save(bean);

		// 会员在线，BeanUserLoginLog
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userStateC3");
		bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("user_id");
		bean.setRefTableQuantityColumn("TIMESTAMPDIFF(HOUR,logoutTime,loginTime)");
		bean.setConditionString(" logoutTime!=null ");
		experienceAndIntegralCountService.save(bean);

		// 成为认证会员，BeanUser
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userStateC4");
		bean.setRefTable(BeanUser.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("id");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" certification='1' ");
		experienceAndIntegralCountService.save(bean);

		// ---------------信息类--------------------
		// 发布新闻、资讯类 信息成功通过审核
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userinformationC1");
		bean.setRefTable(BeanBaseInfo.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" moduletype='2' and status='已审核' ");
		experienceAndIntegralCountService.save(bean);

		// 发布招聘、求职信息成功通过审核
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userinformationC3");
		bean.setRefTable(BeanBaseInfo.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" moduletype='9' and status='已审核' ");
		experienceAndIntegralCountService.save(bean);

		// 发布供应、求购 信息成功通过审核
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userinformationC3");
		bean.setRefTable(BeanBaseInfo.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" moduletype='1' and status='已审核' ");
		experienceAndIntegralCountService.save(bean);

		// ---------------商城管理买家类------------------
		// 买家成功买到商品，BeanOrderItem
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userBuyerC1");
		bean.setRefTable(" ( select it1.id,it2.buyer_id from " + BeanOrderItem.class.getAnnotation(Table.class).name() + " it1," + BeanOrder.class.getAnnotation(Table.class).name() + " it2 where it1.state='1' and it1.isFromAuction='0' and it1.order_id=it2.id ) t ");
		bean.setRefTableUserColumn("buyer_id");
		bean.setRefTableQuantityColumn("1");
		experienceAndIntegralCountService.save(bean);

		// 买家成功竞拍到商品并交易成功，BeanOrderItem
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userBuyerC2");
		bean.setRefTable(" ( select it1.id,it2.buyer_id from " + BeanOrderItem.class.getAnnotation(Table.class).name() + " it1," + BeanOrder.class.getAnnotation(Table.class).name() + " it2 where it1.state='1' and it1.isFromAuction='1' and it1.order_id=it2.id ) t ");
		bean.setRefTableUserColumn("buyer_id");
		bean.setRefTableQuantityColumn("1");
		experienceAndIntegralCountService.save(bean);

		// //发布商品求购，BeanOrderItem
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setCode("userBuyerC3");
		// bean.setRefTable(BeanOrderItem.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// bean.setRefTableQuantityColumn("1");
		// bean.setConditionString(" state='1' and isFromAuction='1' ");
		// experienceAndIntegralCountService.save(bean);

		// //买家被好评，BeanEvaluate
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setCode("userBuyerC4");
		// bean.setRefTable(BeanEvaluate.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// bean.setRefTableQuantityColumn("1");
		// bean.setConditionString(" state='1' and isFromAuction='1' ");
		// experienceAndIntegralCountService.save(bean);

		// //买家被好评，BeanEvaluate
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setCode("userBuyerC5");
		// bean.setRefTable(BeanEvaluate.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// bean.setRefTableQuantityColumn("1");
		// bean.setConditionString(" state='1' and isFromAuction='1' ");
		// experienceAndIntegralCountService.save(bean);

		// //买家被好评，BeanEvaluate
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setCode("userBuyerC6");
		// bean.setRefTable(BeanEvaluate.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// bean.setRefTableQuantityColumn("1");
		// bean.setConditionString(" state='1' and isFromAuction='1' ");
		// experienceAndIntegralCountService.save(bean);

		// ---------------商城管理卖家类------------------
		// 卖家发布商品，BeanOrderItem
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userSellerC1");
		bean.setRefTable(BeanGood.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("user_id");
		bean.setRefTableQuantityColumn("1");
		experienceAndIntegralCountService.save(bean);

		// 卖家发布商品，BeanOrderItem
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userSellerC2");
		bean.setRefTable(BeanGood.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("user_id");
		bean.setRefTableQuantityColumn("1");
		experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //发布招聘信息，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //发布新闻类信息，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //发布企业行情报价，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //发布供应信息，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //发布求购信息，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //发布产品信息，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //删除发布信息，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //删除违规信息，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //成功交易订单，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //增值服务消费，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //通过资质（实名）认证，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);
		//		
		//		
		// //参与网站活动，BeanUserLoginLog
		// bean = new BeanExperienceAndIntegralCount();
		// bean.setKey("userStateC1");
		// bean.setRefTable(BeanUserLoginLog.class.getAnnotation(Table.class).name());
		// bean.setRefTableUserColumn("id");
		// experienceAndIntegralCountService.save(bean);

		// ---------------专家管理类------------------
		// 成为专家, BeanExpert
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userExpertC1");
		bean.setRefTable(BeanExpert.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("user_id");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" status='专家' ");
		experienceAndIntegralCountService.save(bean);

		// 专家资格被取消, BeanExpert
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userExpertC2");
		bean.setRefTable(BeanExpert.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("user_id");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" status='取消' ");
		experienceAndIntegralCountService.save(bean);

		// 发布专家文献, BeanBaseInfo
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userExpertC3");
		bean.setRefTable(BeanBaseInfo.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" moduletype='11' and columntype='2' and status='已审核' ");
		experienceAndIntegralCountService.save(bean);

		// 发布删除文献, BeanBaseInfo
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userExpertC4");
		bean.setRefTable(BeanBaseInfo.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" moduletype='11' and columntype='2' and status='删除' ");
		experienceAndIntegralCountService.save(bean);

		// ---------------增值服务类------------------
		// 参与广告竞价, BeanAdvertAuctionInfo
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userAppreciationC1");
		bean.setRefTable(" (select it1.id,it2.userid from " + BeanAdvertAuctionInfo.class.getAnnotation(Table.class).name() + " it1, (select distinct userid,auctioninfoid from " + BeanAdvertAuctionBidInfo.class.getAnnotation(Table.class).name() + ") it2 where it1.id=it2.auctioninfoid) t ");
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		experienceAndIntegralCountService.save(bean);

		// 广告竞价成功
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userAppreciationC2");
		bean.setRefTable(BeanAdvertAuctionInfo.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" userid is not null ");
		experienceAndIntegralCountService.save(bean);

		// ---------------免费发布类------------------
		// 发布自助广告,BeanSelfAdvert
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userFreeC1");
		bean.setRefTable(BeanSelfAdvert.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" status='已审核' ");
		experienceAndIntegralCountService.save(bean);

		// 自助广告违规被删,BeanSelfAdvert
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userFreeC2");
		bean.setRefTable(BeanSelfAdvert.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" status='被删除' ");
		experienceAndIntegralCountService.save(bean);

		// ---------------评论回复类 （所有评论回复）------------------
		// 发表评论，BeanSelfAdvert
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userCommentC1");
		bean.setRefTable(BeanInfoComment.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" status='已审核' ");
		experienceAndIntegralCountService.save(bean);

		// 发表回复
		bean = new BeanExperienceAndIntegralCount();
		bean.setCode("userCommentC2");
		bean.setRefTable(BeanInfoReply.class.getAnnotation(Table.class).name());
		bean.setRefTableUserColumn("userid");
		bean.setRefTableQuantityColumn("1");
		bean.setConditionString(" status='已审核' ");
		experienceAndIntegralCountService.save(bean);

	}

}
